package com.hc.sss.llz.controller;


import com.hc.sss.common.ResultMap;
import com.hc.sss.pojo.Law;
import com.hc.sss.service.impl.LawServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("law")
public class LawController {

	@Autowired
	private LawServiceImpl lawServiceImpl;

	/*查询法律+分页*/
	@RequestMapping("/findLawList")
	public ResultMap<Law> findLawList(Law law, Integer page, Integer limit) {
		Map<String, Object> paramMap = new HashMap<>();


		paramMap.put("page", page);
		paramMap.put("limit", limit);
		paramMap.put("Law", law);
		ResultMap<Law> resultMap = lawServiceImpl.findLawList(paramMap);
		return resultMap;
	}

	/*删除法律*/
	@RequestMapping("/deleteLaw")
	public int deleteLaw(Integer lawId) {
		return lawServiceImpl.deleteLaw(lawId);
	}

	/*添加法律*/
	@RequestMapping("/insertLaw")
	public int insertLaw(Law law) {
		return lawServiceImpl.insertLaw(law);
	}

	/*修改法律*/
	@RequestMapping("/updateLaw")
	public int updateLaw(Law law) {
		return lawServiceImpl.updateLaw(law);
	}


}
